#include "SFML/Graphics.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_projection.hpp>
#include <glm/gtc/matrix_transform.hpp>

#ifndef __LIGHT_HPP__
#define __LIGHT_HPP__

using namespace glm;


class Light {
	private:
		vec4 m_ambientLight;
		vec4 m_diffuseLight;
		vec4 m_position;
	public:
		static Light* mainLight;

		Light() {
			glEnable(GL_LIGHT0);
			setLight(GL_AMBIENT,vec4(0.3,0.3,0.3,1.0));
			setLight(GL_DIFFUSE,vec4(0.7,0.7,0.7,1.0));
			mainLight = this;
		};
		void setLight(GLenum lightType, vec4 light_) { 
			GLfloat lightValue[] = { light_.r, light_.g, light_.b, light_.a};
    		glLightfv(GL_LIGHT0,lightType,lightValue);

			// value storage
			switch (lightType) {
				case GL_AMBIENT:
					m_ambientLight = light_; break;
				case GL_DIFFUSE:
				default:
					m_diffuseLight = light_; break;
			};
			
		};
		void setPosition(vec4 position_) { 
			m_position = position_;
			GLfloat lightPos[] = {m_position.x, m_position.y, m_position.z, m_position.w};
    		glLightfv(GL_LIGHT0,GL_POSITION,lightPos);
		};

		/** return Light position */
		glm::vec4 getPosition() { return m_position;};

};

#endif
